//#define NX_SINGLE_THREAD

#include "test_nx_trace.h"
#include "test_nx_alloc.h"

#include "platform/thread.h"
#include "platform/atomic.h"
#include "thread/mutex.h"

NX_THREAD_PROC(proc)
{
    nx_lockex_sole(nx::mutex_t);
    nx_out(nx::thread::current_id(), "\t", ++(nx::singleton<long>()), nx::ent);
    return 0;
}

int main(void)
{
    nx::thread::handle_t hd[10] = {0};

    nx_foreach(i, nx::count_of(hd))
        hd[i] = nx::thread::create(proc);
    nx_foreach(i, nx::count_of(hd))
        nx::thread::join(hd[i]);

    /////////////////////////////////////

    test_nx_trace();
    test_nx_alloc();

    /////////////////////////////////////

    return 0;
}
